<?php

declare(strict_types=1);

namespace App\Admin\Mapper\Setting;


use App\Admin\Model\Setting\SettingCrontabLog;
use Illuminate\Database\Eloquent\Builder;
use Newbie\Abstracts\AbstractMapper;

class SettingCrontabLogMapper extends AbstractMapper {
    /**
     * @var SettingCrontabLog
     */
    public $model;

    public function assignModel () {
        $this->model = SettingCrontabLog::class;
    }

    /**
     * 搜索处理器
     */
    public function handleSearch (Builder $query, array $params): Builder {
        if ($params['crontab_id'] ?? false) {
            $query->where('crontab_id', $params['crontab_id']);
        }
        return $query;
    }

}